Python/Tuple MCQ in Python Sample Test,Sample questions

Question:
 What type of error is shown by following statement?
>>>t1 =(1, 2)

>>>t2

1. ValueError

2.TypeError

3.NameError

4.None of the above

Posted Date:-2021-12-13 15:44:28


Question:
 Which of the following is/are features of tuple?

1.Tuple is immutable

2.Tuple is a sequence data type

3.In tuple, elements are enclosed in Parenthesis.

4.All the above

Posted Date:-2021-12-13 15:31:58


Question:
 Which of the following statement will create an empty tuple?

1.P = ( ) b.

2.Q = tuple( )

3.Both of the above

4.None of the above

Posted Date:-2021-12-13 15:33:18


Question:
 Write the output of the following.
>>> t1=((1,2),(3,4),(9,))

>>>max(t1)

1.9

2.(9,)

3.(3,4)

4.None of the above

Posted Date:-2021-12-13 15:45:31


Question:
 Write the output of the following:
a=(1, 2, 3, 2, 3, 4, 5)
print(min(a) + max(a) + a.count(2))

1.13

2.6

3.8

4.Error

Posted Date:-2021-12-13 15:30:58


Question:
 Write the output of the following:
t1 = (23, 45, 67, 43, 21, 41)

print(t1[1:2])

1. (45)

2.(45,)

3.(45, 67)

4.None of the above

Posted Date:-2021-12-13 15:40:44


Question:
>>>min(t1) will return an error if the tuple t1 contains value of mixed data type.

1.True

2.False

3.Error

4.None of the above

Posted Date:-2021-12-13 15:45:50


Question:
In tuples values are enclosed in __________________

1.a. Square brackets

2.Curly brackets

3.Parenthesis

4.None of the above

Posted Date:-2021-12-13 15:25:56


Question:
Tuples are __________________

1.Mutable

2.Immutable

3.Mutable to some extent

4.None of the above

Posted Date:-2021-12-13 15:25:04


Question:
What is the length of the given tuple? >>> t1=(1,2,(3,4,5)

1.1

2.2

3.3

4.4

Posted Date:-2021-12-13 15:35:22


Question:
Which function returns the length of tuple?

1.a. length( )

2.len( )

3.size( )

4.None of the above

Posted Date:-2021-12-13 15:42:12


Question:
Which mathematical operator is used to replicate a tuple?

1. Addition

2.Multiplication

3.Exponent

4.Modulus

Posted Date:-2021-12-13 15:40:01


Question:
Which of the following function return the frequency of particular element in tuple?

1.index( )

2. max( )

3.count( )

4.None of the above

Posted Date:-2021-12-13 15:47:01


Question:
Which of the following function return the frequency of particular element in tuple?

1.index( )

2. max( )

3.count( )

4.None of the above

Posted Date:-2021-12-13 15:47:08


Question:
Which of the following function return the frequency of particular element in tuple?

1.index( )

2. max( )

3.count( )

4.None of the above

Posted Date:-2021-12-13 15:47:08


Question:
Which of the following function return the frequency of particular element in tuple?

1.index( )

2. max( )

3.count( )

4.None of the above

Posted Date:-2021-12-13 15:47:10


Question:
Which of the following is a tuple with single element?

1.t = (1,)

2. t = 1,

3.Both of the above

4.None of the above

Posted Date:-2021-12-13 15:34:03


Question:
Which of the following is not a function of tuple?

1.update( )

2.min( )

3.max( )

4.count( )

Posted Date:-2021-12-13 15:29:39


Question:
Which of the following statement will return an error. T1 is a tuple.

1.T1 + (23)

2. T1 + [3]

3.Both of the above

4.None of the above

Posted Date:-2021-12-13 15:38:02


Question:
Write the output of the following :
>>>t1 = (1,2)

>>> t2 = (1.0, 2.0)

>>> t1 == t2

1.True

2.False

3.Error

4.None of the above

Posted Date:-2021-12-13 15:43:13


Question:
Write the output of the following :
>>>t1 = (1,2)

>>> t2 = (2,1)

>>> t1 == t2

1.True

2.False

3.Error

4.None of the above

Posted Date:-2021-12-13 15:42:45


Question:
Write the output of the following :
a=("Amit", "Sumit","Ashish","Sumanta")
for i in a:
    print(len(i)**2)

1.0 1 4 9

2.16 25 36 49

3.Error

4.1 4 9 16

Posted Date:-2021-12-13 16:15:20


Question:
Write the output of the following.
a=(23,34,65,20,5)
print(a[0]+a.index(5))

1.28

2.29

3.27

4.26

Posted Date:-2021-12-13 15:28:51


Question:
Write the output of the following:
>>>t1 = (1,2,3,4,5)

>>>t2=t1

>>>t2

1.Error

2.(1,2,3,4,5)

3.1,2,3,4,5

4.[1,2,3,4,5]

Posted Date:-2021-12-13 15:36:14


Question:
Write the output of the following:
a=(23,34,65,20,5)
s=0
for i in a:
    if i%2==0:
         s=s+a[i]
print(s)

1.54

2.93

3.94

4.Error

Posted Date:-2021-12-13 15:30:21


Question:
Write the output of the following:
a=(6,8,9,"Sumanta",1)
for i in a:
      print(str(i)*2)

1.66 88 99 SumantaSumanta 11

2.66 88 99 Error

3.Error

4.66 88 99 SumantaSumanta Error

Posted Date:-2021-12-13 16:16:14


More MCQS

  1. Python MCQS - Function
  2. Python MCQS - GUI in python
  3. Python MCQS - Operators
  4. Python MCQS - Data type in python
  5. Python MCQS - loops in python
  6. Python MCQS - Numpy
  7. Python MCQS - sqlite3
  8. Python MCQS - Library
  9. Python MCQS - Pandas
  10. Python MCQs
  11. Dictionary Python MCQ set 1
  12. Dictionary Python MCQ set 2
  13. MCQ For Python Fundamentals
  14. MCQ Introduction to Python Section 1
  15. MCQ Introduction to Python Section 2
  16. MCQ Introduction to Python Section 3
  17. MCQ on Flow of Control in Python Set 1
  18. MCQ on Flow of Control in Python Set 2
  19. MCQ on Python String Set 1
  20. File Handling in Python section 1
  21. File Handling in Python section 2
  22. Python Functions MCQS Set 1
  23. Python Functions MCQS Set 2
  24. MCQ on List in Python
  25. Pandas MCQ Questions Set 1
  26. Pandas MCQ Questions Set 2
  27. Tuple MCQ in Python
  28. Python dataframe MCQ
  29. Python Mcq Set 1
  30. Python Mcq Set 2
  31. Python Mcq Set 3
  32. Python Mcq Set 4
  33. Python Mcq Set 5
  34. Python Mcq Set 6
  35. Python Mcq Set 7
  36. Python Mcq Set 8
  37. Python Mcq Set 9
  38. Python Mcq Set 10
  39. Python Mcq Set 11
  40. Python Mcq Set 12
  41. Python Mcq Set 13
  42. Python Mcq Set 14
  43. Python Mcq Set 15
  44. Python Mcq Set 16
  45. Python Mcq Set 17
  46. Python Mcq Set 18
  47. Python Mcq Set 19
  48. Python Mcq Set 20
  49. Python Mcq Set 21
  50. Python MCQ
  51. Python MCQ Questions with Answer
  52. Test
  53. python mcq question and answer
Search
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!